Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2802 closed enhancement (fixed)

[raster] ST_MapAlgebra checks callbacks parameters but not return type

Reported by: strk Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.1.4
Component: raster Version: 2.1.x
Keywords: history Cc:

Description

I tried using a callback only accepting 2 arguments and ST_MapAlgebra complained about that. But it did not complain about the callback returning an integer rather than a float8.

As the C code fetches the return value in binary form, I guess returning anything but "float8" would just not work, silently.

If this is confirmed, it would be nice for ST_MapAlgebra to also check the return type of the provided callback.

Change History (6)

comment:1 by dustymugs, 10 years ago

Status: newassigned

comment:2 by dustymugs, 10 years ago

The check for return type will throw an Exception if not a double precision.

comment:3 by strk, 10 years ago

I didnt' get an exception when returning integer. Looking at the code the return type check only prevents your callback from returning a SET.

comment:4 by dustymugs, 10 years ago

I'll probably fix this as I fix #2803.

comment:5 by dustymugs, 10 years ago

Keywords: history added
Milestone: PostGIS 2.1.4
Resolution: fixed
Status: assignedclosed
Version: trunk2.1.x

Fixed for -trunk in r12744. Fixed for -2.1 in r12745.

comment:6 by strk, 10 years ago

Great, thanks!

nitpicking: the error printed on returning a SET still says you need to return a "double precision", while if you return a "text" (for example) the error tells you that also int,smallint and float4 are accepted.

Note: See TracTickets for help on using tickets.